package org.example.springbootrabbitmq.delayed;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.boot.autoconfigure.amqp.RabbitProperties;
import org.springframework.stereotype.Component;

import java.util.Date;

@Slf4j
@Component
public class ConsumeForDelayMessage {

    @RabbitListener(queues = {DelayedQueueConfig.DELAYED_QUEUE})
    public void consumeForDelayMessage(Message message) {
        String msg = new String(message.getBody());
        log.info("当前时间:{}，收到延迟队列消息：{}", new Date(),msg);
    }
}
